package com.example.springboot.mapper;

import com.example.springboot.entity.BlogCorrect;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface BlogCorrectMapper {
    @Insert("INSERT INTO blog_corrects (post_id, text_id, correct_text, author_id, like_count) " +
            "VALUES (#{postId}, #{textId}, #{correctText}, #{authorId}, #{likeCount})")
    void insert(BlogCorrect blogCorrect);
    @Select("SELECT id,post_id as postId,text_id as textId,correct_text as correctText,author_id as authorId,like_count as likeCount FROM blog_corrects WHERE post_id = #{postId} AND text_id = #{textId} LIMIT #{pageSize} OFFSET #{offset}")
    List<BlogCorrect> findList(Integer offset, Integer pageSize, Integer postId, String textId);
}
